package com.aaa.charge.api.CareHistory;

import com.aaa.charge.feign.DateFegin;
import com.aaa.charge.service.CareHistoryService;
import com.aaa.charge.vo.PostObjectVo;
import com.aaa.entity.CareHistory;
import com.aaa.entity.CareOrderItem;
import com.aaa.entity.DictData;
import com.aaa.entity.OrderChargeItem;
import com.aaa.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author pzs
 * @date 2023/3/27 9:37
 * @description ApiCareHistory
 */
@RestController
@RequestMapping("charge/api/careHistory")
public class ApiCareHistory {
    @Resource
    private CareHistoryService careHistoryService;
    @Resource
    private DateFegin dateFegin;

    /**
     * 处方收费
     * 查询病列 处方
     */

    @GetMapping("getRegId/{regId}")
    public Result<Map<String,Object>> findcareHistory(@PathVariable String regId){
        return careHistoryService.findcareHistory(regId);
    }

    //状态。类型。。。
    @GetMapping("getByType/{type}")
    public Result<List<DictData>> getByType(@PathVariable String type){
        Result<List<DictData>> list = dateFegin.list(type);
        return list;
    }

    //现金
    @PostMapping("payObj")
    public Result payObj(@RequestBody PostObjectVo postObjectVo){
        return careHistoryService.updateStatus(postObjectVo);
    }

    //微信
    @PostMapping("payWx")
    public Result payWx(@RequestBody PostObjectVo postObjectVo){
        return careHistoryService.payWx(postObjectVo);
    }
    @PostMapping("status/{orderId}")
    public Result payStatus(@PathVariable String orderId){
        return careHistoryService.payStatus(orderId);
    }

}
